<!-- 登录拦截 -->
<script src="../assets/js/jquery.min.js"></script>
<script>
    var id = sessionStorage.getItem('userId')
    if (!id) {
        location.href = 'login.html'
    }
</script>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理-文章列表</title>
    <link rel="stylesheet" href="../assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="../assets/css/admin/common.css">
    <link rel="stylesheet" href="../assets/css/admin/allArticle.css">
    <link rel="stylesheet" href="../assets/utils/nprogress/nprogress.css">
    <script src="../assets/utils/nprogress/nprogress.js"></script>

</head>

<body>
    <!-- 添加一个进度条 -->
    <script>
        NProgress.start()
    </script>
    <!-- 1、左边导航栏区域 -->
    <div class="aside">
        <!-- 1-1-用户头像信息 -->
        <div class="user-info" id="userData">
            <img src="../assets/uploads/5.jpg" alt="">
            <h3>梦里百川</h3>
        </div>
        <!-- 1-2-菜单栏信息 -->
        <ul class="nav">
            <li>
                <a href="index.html"><span class="glyphicon glyphicon-equalizer"></span>首页</a>
            </li>
            <li class="active">
                <a href="#menu-posts" data-toggle="collapse">
                    <span class="glyphicon glyphicon-level-up"></span>文章<i class="glyphicon glyphicon-menu-down"></i>
                </a>
                <ul id="menu-posts" class="collapse in">
                    <li class="active"><a href="allArticle.html">所有文章</a></li>
                    <li><a href="writeArticle.html">写文章</a></li>
                    <li><a href="catalogArticle.html">文章类别</a></li>
                </ul>
            </li>

            <li>
                <a href="comments.html"><span class="glyphicon glyphicon-equalizer"></span>评论</a>
            </li>
            <li>
                <a href="users.html"><span class="glyphicon glyphicon-equalizer"></span>用户</a>
            </li>
            <li>
                <a href="#menu-settings" class="collapsed" data-toggle="collapse">
                    <span class="glyphicon glyphicon-equalizer"></span>设置<i class="glyphicon glyphicon-menu-down"></i>
                </a>
                <ul id="menu-settings" class="collapse">
                    <li><a href="rotation.html">图片轮播</a></li>
                    <li><a href="settings.html">网站设置</a></li>
                </ul>
            </li>
        </ul>
    </div>
    <!-- 2、主体内容区域 -->
    <div class="main">
        <!-- 2-1-顶部小白条 -->
        <div class="navbar">
            <h3 class="title">文章列表</h3>
            <ul>
                <li><a href="resetPwd.html"><i class="glyphicon glyphicon-wrench"></i> 修改密码</a></li>
                <li><a href="login.html"><i class="glyphicon glyphicon-off"></i> 退出登录</a></li>
            </ul>
        </div>
        <!-- 2-2-主体内容 -->
        <div class="container-box">
            <div class="page-box">
                <!-- 2-2-1-下拉菜单 -->
                <form class="form-inline  pull-left" id="selectForm">
                    <select name="category" class="form-control " id="type">
                        <option value="">所有分类</option>
                    </select>
                    <select name="state" class="form-control">
                        <option value="">所有状态</option>
                        <option value="0">草稿</option>
                        <option value="1">已发布</option>
                    </select>
                    <button class="btn btn-primary">筛选</button>
                </form>
                <!-- 2-2-2-分页 -->
                <ul class="pagination pull-right" id="pageSize">
                    <li>
                        <a href="#" aria-label="Previous">
                            <span aria-hidden="true">上一页</span>
                        </a>
                    </li>
                    <li><a href="#">1</a></li>
                    <li><a href="#">2</a></li>
                    <li>
                        <a href="#" aria-label="Next">
                            <span aria-hidden="true">下一页</span>
                        </a>
                    </li>
                </ul>
            </div>
            <!-- 2-2-2表格 -->
            <table class="table table-striped table-bordered table-hover">
                <thead>
                    <tr>
                        <th>标题</th>
                        <th>作者</th>
                        <th>分类</th>
                        <th>发表时间</th>
                        <th>状态</th>
                        <th class="text-center" width="250">操作</th>
                    </tr>
                </thead>
                <tbody>

                    <tr>
                        <td>鲁智胜倒拔</td>
                        <td>鲁智深</td>
                        <td>名著</td>
                        <td>公元某某年</td>
                        <td>以发布</td>
                        <td class="text-center">
                            <a href="javascript:;" class="btn btn-primary  btn-sm">编辑</a>
                            <a href="javascript:;" class="btn btn-danger  btn-sm">删除</a>
                        </td>
                    </tr>
                    <tr>
                        <td>鲁智胜倒拔</td>
                        <td>鲁智深</td>
                        <td>名著</td>
                        <td>公元某某年</td>
                        <td>以发布</td>
                        <td class="text-center">
                            <a href="javascript:;" class="btn btn-primary  btn-sm">编辑</a>
                            <a href="javascript:;" class="btn btn-danger  btn-sm">删除</a>
                        </td>
                    </tr>
                    <tr>
                        <td>鲁智胜倒拔</td>
                        <td>鲁智深</td>
                        <td>名著</td>
                        <td>公元某某年</td>
                        <td>以发布</td>
                        <td class="text-center">
                            <a href="javascript:;" class="btn btn-primary  btn-sm">编辑</a>
                            <a href="javascript:;" class="btn btn-danger  btn-sm">删除</a>
                        </td>
                    </tr>
                    <tr>
                        <td>鲁智胜倒拔</td>
                        <td>鲁智深</td>
                        <td>名著</td>
                        <td>公元某某年</td>
                        <td>以发布</td>
                        <td class="text-center">
                            <a href="javascript:;" class="btn btn-primary btn-sm">编辑</a>
                            <a href="javascript:;" class="btn btn-danger  btn-sm">删除</a>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>

    </div>



    <!-- js -->
    <script src="/assets/js/jquery.min.js"></script>
    <script src="/assets/js/bootstrap.min.js"></script>
    <script src="../assets/js/common.js"></script>
    <script src="../assets/js/allArticle.js"></script>
    <script src="../assets/utils/art-template/template-web.js"></script>
    <script>
        NProgress.done()
    </script>
    <!-- 文章列表-模板引擎-开 始 -->
    <script type="text/html" id="articTpl">
        {{each data.records}}
        <tr>
            <td>{{$value.title}}</td>
            <td>{{$value.author.nickName}}</td>
            <td>{{$value.category.title}}</td>
            <td>{{$imports.formate($value.createAt)}}</td>
            <td>{{$value.state ==1?'已发布':'未发布'}}</td>
            <td class="text-center">
                <a href="writeArticle.html?id={{$value._id}}" class="btn btn-primary  btn-sm">编辑</a>
                <a href="javascript:;"  class="deleteBtn btn btn-danger  btn-sm" data-id="{{$value._id}}">删除</a>
            </td>
        </tr>
        {{/each}}
    </script>
    <!-- 文章列表-模板引擎-结束 -->
    <!-- 分页模板-开始 -->
    <script type="text/html" id="pageTpl">
        {{if data.page>1}}
        <li>
            <a href="javascript:;" aria-label="Previous" onclick="changePage({{data.page-1}})">
                <span aria-hidden="true">上一页</span>
            </a>
        </li>
        {{/if}}
        {{each data.display}}
        <li><a href="javascript:;" class="{{$value}}_id" onclick="changePage({{$value}})">{{$value}}</a></li>
        {{/each}}
        {{if data.page< data.pages}}
        <li>
            <a href="javascript:;" aria-label="Next" onclick="changePage({{data.page+1}})">
                <span aria-hidden="true">下一页</span>
            </a>
        </li>
        {{/if}}
    </script>
    <!-- 分页模板-结束 -->
    <!-- 文章分类模板-开始 -->
    <script type="text/html" id="cateTpl">
        {{each data}}
        <option value="{{$value._id}}">{{$value.title}}</option>
        {{/each}}
    </script>
    <!-- 文章分类模板-结束 -->
</body>

</html>